Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworking locations #54

Merged
merged 8 commits into from
May 8, 2024
Merged

Reworking locations #54

merged 8 commits into from
May 8, 2024

Conversation

arnasbr
Copy link
Contributor

@arnasbr arnasbr commented Apr 26, 2024

  • Moved all locations to external csv files
  • Specified the city for each location ("LT" -> "LT/Vilnius")
  • Removed the ability to specify coordinates through env vars, as it makes the logic complicated (especially for proto requests) and now it's very easy to simply add your new location to the json files.
  • Updated README to reflect the changes

Also removed this "us_hi": { "lat": 21.3098845, "lng": -157.8581401 } location from proto locations, as it just points to the ocean. Let me know if this is actually a useful location.

@arnasbr arnasbr self-assigned this Apr 26, 2024
Comment on lines 47 to 52
const location = __ENV.LOCATION || 'UK/London'
const country = location.slice(0, 2).toLowerCase()
const countryCoords = getProtoCountryCoordinates(location)

const query = __ENV.QUERY || `api/v2/${countryCode(country)}/time-filter/fast/${transportation}`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the location.slice is used to get the iso2 country-code from the location, it's needed to construct the proto request url. I could make the user specify the iso2 code manually, but this might be simpler

Copy link
Contributor Author

@arnasbr arnasbr Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tho it could break if the user decides to add a new location and doesn't follow the same naming pattern. I have a warning on this in readme

@arnasbr
Copy link
Contributor Author

arnasbr commented May 6, 2024

https://simplemaps.com/data/world-cities data was taken from here (the Basic package). I filtered out only the primary capitals.

The file by default is a csv, I turned it into json manually. I can turn it back to csv if that would be more convenient

@arnasbr arnasbr marked this pull request as draft May 7, 2024 12:31
@arnasbr arnasbr marked this pull request as ready for review May 7, 2024 13:34
@danielnaumau
Copy link
Contributor

lgtm

@arnasbr arnasbr merged commit 10a01bf into master May 8, 2024
1 check passed
@arnasbr arnasbr deleted the update-country-names branch May 8, 2024 14:06
@arnasbr arnasbr restored the update-country-names branch June 10, 2024 11:06
@arnasbr arnasbr deleted the update-country-names branch June 10, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants